package cn.shyouchi.wuguanjia.android.ui.attendance.signin;

import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.shyouchi.wuguanjia.android.R;
import cn.shyouchi.wuguanjia.android.base.BaseActivity;
import cn.shyouchi.wuguanjia.android.widget.TopBar;

import static cn.shyouchi.wuguanjia.android.ui.attendance.AttendanceTokePhotoActivity.RESULT_CODE;

public class SignExtraMsgActivity extends BaseActivity {

    @BindView(R.id.topBar)
    TopBar mTopBar;
    @BindView(R.id.edit_extra_msg)
    EditText mEditExtraMsg;
    @BindView(R.id.btn_save)
    Button mBtnSave;
    @BindView(R.id.activity_add_handover)
    LinearLayout mActivityAddHandover;

    @Override
    public int initContentView() {
        return R.layout.activity_sign_extra_msg;
    }

    @Override
    public void initInjector() {

    }

    @Override
    public void initUiAndListener() {
        ButterKnife.bind(this);
        mTopBar.setTitle(getTitle().toString());
        mTopBar.setLeftIcon(R.mipmap.ic_back);
        setSupportActionBar(mTopBar.getToolbar());
    }

    @Override
    protected boolean isApplyStatusBarTranslucency() {
        return false;
    }

    @Override
    protected boolean isApplyStatusBarColor() {
        return true;
    }


    @OnClick(R.id.btn_save)
    public void onClick() {
        if (TextUtils.isEmpty(mEditExtraMsg.getText().toString())) {
            mEditExtraMsg.setError("外出说明不能为空");
            return;
        }
        setResult(RESULT_CODE, getIntent().putExtra("extra_msg", mEditExtraMsg.getText().toString()));
        finish();
    }
}
